package com.los.rabbitmq.spring;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.context.support.AbstractApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @program: rabbitmq
 * @description:生产者
 * @author: Yujuan
 * @create: 2018-08-02 20:46
 **/
public class SpringMain {
    public static void main(String[] args) throws InterruptedException {
        AbstractApplicationContext ctx=new ClassPathXmlApplicationContext("classpath:context.xml");
        RabbitTemplate template=ctx.getBean(RabbitTemplate.class);
        template.convertAndSend("Hello World");
        Thread.sleep(2000);
        ctx.destroy();//容器销毁
    }
}
